<?
require_once 'Mysql.php';

class plan extends MySQL
{

	private $plan;
		
	/*function __construct($plan='')
        {
            $this->plan=$plan;
        }*/
        
	public function crearPlan($id,$dato)
	{
		$this->conectar();
		$this->consulta("insert into plan (idplan,carrera) values ('$id','$dato')");
		$this->desconectar();
	}
	
	public function listPlan()
	{
		$arreglo=array();
		$this->conectar();
		$query=$this->consulta("select * from plan order by idplan");
		while($datos=$this->fetch_array())
		{
			$arreglo[]=$datos;
		}
		$this->desconectar();
		return $arreglo;
	}
	
		public function updatePlan($id,$nombre)
	{
		$this->conectar();
		$this->consulta("update plan set carrera='".$nombre."' where idplan='".$id."'");
		$this->desconectar();
	}
	
		public function salida($mensaje,$url)
	{
		echo '<script language="javascript">
		alert("'.$mensaje.'");
		location.href="../'.$url.'";
		</script>';
	}
	
		public function borrarPlan($id)
	{
		$this->conectar();
		$this->consulta("delete from plan where idplan='".$id."'");
		$this->desconectar();
	}
}

?>